using DeviceCommons.DeviceMessages.Models.V1;

namespace DeviceCommons.DeviceMessages.Factories
{
    /// <summary>
    /// 快速读数状态工厂接口
    /// 支持根据设备类型配置直接解析状态，无需层层解析
    /// </summary>
    public interface IFastReadingStateFactory
    {
        /// <summary>
        /// 检查设备类型是否支持快速解析
        /// </summary>
        /// <param name="deviceType">设备类型</param>
        /// <returns>是否支持快速解析</returns>
        bool SupportsFastParsing(byte deviceType);

        /// <summary>
        /// 快速解析读数状态
        /// </summary>
        /// <param name="bytes">状态数据字节数组</param>
        /// <param name="deviceType">设备类型</param>
        /// <returns>解析后的读数状态</returns>
        IDeviceMessageInfoReadingStates ParseReadingStates(ReadOnlySpan<byte> bytes, byte deviceType);

        /// <summary>
        /// 计算设备类型的状态数据总长度
        /// </summary>
        /// <param name="deviceType">设备类型</param>
        /// <returns>状态数据总长度</returns>
        int CalculateStateDataLength(byte deviceType);
    }
}
